//shape.h
#ifndef __SHAPE_H
#define __SHAPE_H

struct ShapeBase;
struct Point;

typedef void (*DrawFunc)(ShapeBase*);
typedef void (*TranslateFunc)(ShapeBase*, Point);

struct ShapeBase {
    DrawFunc draw;
    TranslateFunc translate;
    ShapeBase* next;
};

struct Point {
    int x;
    int y;
};

struct Line {
    ShapeBase base;
    Point p1;
    Point p2;
};

struct Circle {
    ShapeBase base;
    Point center;
    int radius;
};

struct Rect {
    ShapeBase base;
    Line width;
    Line heigth;
};

struct Figure {
    ShapeBase *head;
    ShapeBase *tail;
    int nbShapes;
};

Line *createLine(Point, Point);
Circle *createCircle(Point, int);
Rect *createRect(Line, Line);
void drawLine(Line *);
void drawCircle(Circle *);
void drawRect(Rect *);
void translateLine(Line *, Point);
void translateCircle(Circle *, Point);
void translateRect(Rect *, Point);
Figure *createFigure();
void destroyFigure(Figure *);
void addShape(Figure *, ShapeBase *);
void drawFigure(Figure *);
void showMenu();
char getCommand();
Point getPoint(const char*);
int getInt(const char*);
void translateFigure(Figure*, Point);
#endif